Array Activities in ArrayPractice
In a method public void practiceArrayInts() do the following (just do one after the other):
- Create an array size 10 of integers.
- Have it have the values 10,20,30,40,50 and so on.
- Print out all the numbers in the array.
- Find the sum of all the numbers in the array and print that out.//use a loop
- Add 7 to every number in the array. //use a loop
In a method public void practiceArrayStrings() do the following: (
- Create an array with 3 names.
- Have it print out every name on its own line.
- Have it print out the length of each name ( ie Jeff -> 4
letters
- Have it replace all the a and e with z.
- Have it print it out.
Start with the coede below:
/**
* ArrayPractice - basic practice of Arrays
*
* @author (your name)
* @version 1-3-13
*/
public class ArrayPractice
{
public void practiceArrayInts()
{
}
public void practiceArrayStrings()
{
}
}
|